import {reqCategoryList, reqGetBannerList, reqFloorList} from "@/api";

const state = {
    categoryList: [],
    bannerList: [],
    floorList: []
};
const actions = {
    async getCategoryList({commit}) {
        let result = await reqCategoryList()
        if (result.code === 200) {
            commit('CATEGORY_LIST', result.data)
        }
        // console.log(result);
    },
    async getBannerList({commit}) {
        let result = await reqGetBannerList()
        if (result.code === 200) {
            commit('BANNER_LIST', result.data)
        }
        // console.log(result)
    },
    async getFloorList({commit}) {
        let result = await reqFloorList()
        if (result.code === 200) {
            commit('FLOOR_LIST', result.data)
        }
    },
};
const mutations = {
    CATEGORY_LIST(state, categoryList) {
        state.categoryList = categoryList
    },
    BANNER_LIST(state, bannerList) {
        // console.log(bannerList)
        state.bannerList = bannerList
    },
    FLOOR_LIST(state, floorList) {
        state.floorList = floorList
    },
};
const getters = {};

export default {
    state,
    mutations,
    actions,
    getters
};